function test_single_layer()
    % 创建模型实例
    model = model_cifar10();
    
    fprintf('=== Testing Individual Layers ===\n\n');
    
    % 1. 测试 Depthwise Conv2D
    fprintf('Testing Depthwise Conv2D Layer:\n');
    input_dw = int8(randi([-128, 127], [1, 32, 32, 3]));  % 示例输入
    output_dw = model.depthwise_conv2d(input_dw, 1);
    fprintf('  Input shape: %s\n', mat2str(size(input_dw)));
    fprintf('  Output shape: %s\n', mat2str(size(output_dw)));
    fprintf('  Output range: [%d, %d]\n\n', min(output_dw(:)), max(output_dw(:)));
    
    % 2. 测试 Batch Normalization
    fprintf('Testing Batch Normalization Layer:\n');
    output_bn = model.batch_normalize(output_dw, 1);
    fprintf('  Input shape: %s\n', mat2str(size(output_dw)));
    fprintf('  Output shape: %s\n', mat2str(size(output_bn)));
    fprintf('  Output range: [%d, %d]\n\n', min(output_bn(:)), max(output_bn(:)));
    
    % 3. 测试 Pointwise Conv2D
    fprintf('Testing Pointwise Conv2D Layer:\n');
    output_pw = model.pointwise_conv2d(output_bn, 1);
    fprintf('  Input shape: %s\n', mat2str(size(output_bn)));
    fprintf('  Output shape: %s\n', mat2str(size(output_pw)));
    fprintf('  Output range: [%d, %d]\n\n', min(output_pw(:)), max(output_pw(:)));
    
    % 4. 测试 Global Average Pooling
    fprintf('Testing Global Average Pooling Layer:\n');
    input_gap = int8(randi([-128, 127], [1, 8, 8, 128]));  % GAP的输入
    output_gap = model.global_average_pooling(input_gap);
    fprintf('  Input shape: %s\n', mat2str(size(input_gap)));
    fprintf('  Output shape: %s\n', mat2str(size(output_gap)));
    fprintf('  Output range: [%d, %d]\n\n', min(output_gap(:)), max(output_gap(:)));
    
    % 5. 测试 Fully Connected
    fprintf('Testing Fully Connected Layer:\n');
    output_fc = model.fully_connected(output_gap);
    fprintf('  Input shape: %s\n', mat2str(size(output_gap)));
    fprintf('  Output shape: %s\n', mat2str(size(output_fc)));
    fprintf('  Output range: [%d, %d]\n\n', min(output_fc(:)), max(output_fc(:)));
    
    % 打印最终结果
    fprintf('=== Test Complete ===\n');
    fprintf('All layers tested successfully!\n');
end 